﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Linq;
using System.Data.Linq;
using WX.WMS.DataModel;
using WX.WMS.Common;
using WX.WMS.BLL;

public partial class Product_ProductManager : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

            object action = Request.QueryString["action"];
            if (action != null && action.ToString().Equals("del"))
            {
                string ID = Request.QueryString["ID"].ToString();
                ProductBLL BllProduct = new ProductBLL();
                if (BllProduct.DeleteProduct(ID) < 0)
                {
                    ShowMessage("删除失败");

                }

            }
            BoundGridViewData();


    }
    protected void searchButton_Click(object sender, ImageClickEventArgs e)
    {
        BoundGridViewData();
    }

    protected void BoundGridViewData()
    {

        string strProductName = "";

        strProductName = this.txtProductName.Text.Trim();

        ProductBLL productBLL = new ProductBLL();
        List<T_PRODUCT> productList = new List<T_PRODUCT>();
        productBLL.AddLikeCondition("NAME", strProductName);
        productList = productBLL.GetProductList().ToList();

        if (productList.Count > 0)
        {
            this.SearchResult.DataSource = productList;
            this.SearchResult.DataBind();
        }
        else
        {
            Label1.Visible = true;

        }
    }
    protected void SearchResult_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.SearchResult.PageIndex = e.NewPageIndex;
        BoundGridViewData();
    }
}
